package com.entor.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.entor.dao.ThoughtDaoI;
import com.entor.model.Msg;
import com.entor.model.Thought;


@Service
public class ThoughtService implements BaseServiceI<Thought>{


	@Autowired
	public ThoughtDaoI tdi;
	
	
	public List<Thought> find(Thought t) {
		
		return tdi.find(t);
		
	}

	public Thought get(Thought t) {
		
		List<Thought> list = this.find(t);
		return list.size()>0?list.get(0):null;
	}

	public Msg insert(Thought t) {
		
		int i = tdi.insert(t);
		Msg m = new Msg("新增失败！",false);
		if(i>0){
			 m = new Msg("新增成功！",true);
		}
		return m;
	}

	public Msg batchInsert(String objs) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg edit(Thought t) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg remove(Integer id) {
		int i = tdi.remove(id);
		Msg m = new Msg("删除失败！",false);
		if(i>0){
			 m = new Msg("删除成功！",true);
		}
		return m;
	}

	public Msg batchRemove(String ids) {
		// TODO Auto-generated method stub
		return null;
	}

}
